package com.itheima79.googleplay.adapter;

import java.util.ArrayList;

import uk.co.senab.photoview.PhotoView;

import com.itheima79.googleplay.global.GooglePlayApplication;
import com.itheima79.googleplay.global.ImageLoaderOptions;
import com.itheima79.googleplay.http.Api;
import com.nostra13.universalimageloader.core.ImageLoader;

import android.graphics.Matrix;
import android.view.ViewGroup;
import android.widget.ImageView;

public class ImageScaleAdapter extends BasePagerAdapter<String>{

	public ImageScaleAdapter(ArrayList<String> list) {
		super(list);
	}
	@Override
	public Object instantiateItem(ViewGroup container, int position) {
//		ImageView imageView = new ImageView(GooglePlayApplication.context);
		PhotoView imageView = new PhotoView(GooglePlayApplication.context);
		
		ImageLoader.getInstance().displayImage(Api.IMAGE_PREFIX+list.get(position), imageView,ImageLoaderOptions.fadein_options);
		
		//将ImageView加入到ViewPager中
		container.addView(imageView);
		return imageView;
	}

}
